package com.cs.common.result;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;
import java.util.Date;


@Getter@ToString@Setter
public class HttpResp<T> implements Serializable {

    private ResultCode resultCode;

    @JsonFormat(timezone = "GMT+8")
    private Date time;

    private T results;


    private HttpResp(){}


    public static <T> HttpResp <T> result(ResultCode resultCode, Date time,T results){

        HttpResp<T> httpResp = new HttpResp<>();
        httpResp.setResultCode(resultCode);
        httpResp.setTime(time);
        httpResp.setResults(results);
        return httpResp;
    }
}